//
//  RBOtherPayPopVC.m
//  zhongzhenglu
//
//  Created by XL on 2022/9/8.
//

#import "RBOtherPayPopVC.h"
#import "RBDefine.h"
#import "UIView+RBAdd.h"
#import "UIScrollView+RBAdd.h"
#import <Masonry.h>
#import "RBThemeConfig.h"
#import <UIColor+YYAdd.h>
#import <UIView+YYAdd.h>
#import "RBPager.h"
#import "RanTool.h"

@interface RBOtherPayPopVC ()

@end

@implementation RBOtherPayPopVC

#pragma mark - Lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setup];
}

#pragma mark - Private

- (void)setup
{
    self.contentView = UIView.new;
    self.contentView.backgroundColor = [RBThemeConfig bgGrayColor];
    [self.view addSubview:self.contentView];
    [self.contentView rbSetCorner:UIRectCornerTopLeft | UIRectCornerTopRight radius:Zoom(8)];
    
    [self.contentView view_addView:[RanTool labelWithFontSize:Zoom(15) weight:0 color:[RBThemeConfig textBlackColor] align:0 text:@"邀请好友帮忙付款"] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(28) bottom:0 left:CGFLOAT_MIN right:CGFLOAT_MIN centerX:YES];
    
    UIImageView *closeBtn = [RanTool imgViewWithMode:0 radius:0 imgName:@"goodsDetailPramsClose"];
    [closeBtn extendResponseArea];
    [closeBtn rbAddTapGesWithTarget:self action:@selector(dismiss)];
    [self.contentView addSubview:closeBtn];
    [closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.mas_equalTo(Zoom(18));
        make.top.mas_equalTo(Zoom(22));
        make.right.mas_equalTo(-Zoom(16));
    }];
    
    [self.contentView view_addView:[RanTool labelWithFontSize:Zoom(14) weight:0 color:[RBThemeConfig textGrayColor] align:1 text:@"代付金额"] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(23) bottom:0 left:0 right:0 centerX:0];
    [self.contentView view_addView:({
        UILabel *view = UILabel.new;
        view.attributedText = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
            [maker addAttributeStringWithFont:[UIFont boldSystemFontOfSize:Zoom(15)] color:[RBThemeConfig priceRedColor] string:@"¥"];
            [maker addAttributeStringWithFont:[UIFont boldSystemFontOfSize:Zoom(24)] color:[RBThemeConfig priceRedColor] string:@"6666"];
            [maker addAttributeStringWithFont:[UIFont boldSystemFontOfSize:Zoom(15)] color:[RBThemeConfig priceRedColor] string:@".00"];
        }];
        view;
    }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(23) bottom:0 left:CGFLOAT_MIN right:CGFLOAT_MIN centerX:YES];
    [self.contentView view_addView:({
        UILabel *view = [RanTool labelWithFontSize:Zoom(12) weight:0 color:[RBThemeConfig textGrayColor] align:0 text:@"温馨提示：好友需微信支付帮你付款，若未来退款，退款资金将原路退回好友的付款账户" bgColor:nil radius:0 borderWidth:0 borderColor:nil lines:0 linePadding:Zoom(9) hPriority:0];
        view.preferredMaxLayoutWidth = kRBMainScreenWidth - Zoom(18)*2;
        view;
    }) withHeight:CGFLOAT_MIN width:kRBMainScreenWidth - Zoom(18)*2 top:Zoom(20) bottom:0 left:Zoom(18) right:CGFLOAT_MIN centerX:8];
    [self.contentView view_addView:({
        UIView *view = UIView.new;
        view.backgroundColor = UIColor.whiteColor;
        [view rbSetCornerRadius:Zoom(5)];
        [view h_view_addView:[RanTool imgViewWithMode:2 radius:Zoom(5) imgName:@"b1.jpg"] withHeight:Zoom(81) width:Zoom(81) top:Zoom(11) bottom:CGFLOAT_MIN left:Zoom(12) right:CGFLOAT_MIN centerY:NO];
        [view h_view_addView:({
            UIView *view = UIView.new;
            [view view_addView:({
                UILabel *view = [RanTool labelWithFontSize:Zoom(15) weight:0 color:[RBThemeConfig textBlackColor] align:0 text:@"全自动清洗消毒机带干燥供应全自动清洗消毒机带干燥供应..." bgColor:nil radius:0 borderWidth:0 borderColor:nil lines:2 linePadding:Zoom(7) hPriority:0];
                view.preferredMaxLayoutWidth = Zoom(214);
                view;
            }) withHeight:CGFLOAT_MIN width:Zoom(214) top:0 bottom:CGFLOAT_MIN left:0 right:CGFLOAT_MIN centerX:0];
            [view view_addView:({
                UILabel *view = UILabel.new;
                view.attributedText = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
                    [maker addAttributeStringWithFont:[UIFont boldSystemFontOfSize:Zoom(13)] color:[RBThemeConfig textBlackColor] string:@"¥"];
                    [maker addAttributeStringWithFont:[UIFont boldSystemFontOfSize:Zoom(18)] color:[RBThemeConfig textBlackColor] string:@"666"];
                    [maker addAttributeStringWithFont:[UIFont boldSystemFontOfSize:Zoom(13)] color:[RBThemeConfig textBlackColor] string:@".00"];
                }];
                view;
            }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(5) bottom:CGFLOAT_MIN left:0 right:0 centerX:0];
            view;
        }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(18) bottom:0 left:Zoom(13) right:Zoom(23) centerY:0];
        view;
    }) withHeight:Zoom(104) width:CGFLOAT_MIN top:Zoom(22) bottom:0 left:Zoom(17) right:Zoom(13) centerX:0];
    [self.contentView view_addView:({
        UILabel *view = [RanTool labelWithFontSize:Zoom(15) weight:0 color:UIColor.whiteColor align:1 text:@"发送给微信好友" bgColor:[RBThemeConfig buttonBlueColor] radius:Zoom(23)];
        [view rbAddTapGesWithTarget:self action:@selector(dismiss)];
        view;
    }) withHeight:Zoom(46) width:Zoom(350) top:Zoom(60) bottom:MAX(kRBSafeBottomHeight, Zoom(28)) left:CGFLOAT_MIN right:CGFLOAT_MIN centerX:YES];
    
    self.view.backgroundColor = UIColor.clearColor;
    self.contentView.width = kRBMainScreenWidth;
    self.contentView.height = self.contentView.esSize.height;
    self.contentView.left = 0;
    self.contentView.top = kRBMainScreenHeight;
}

- (void)show
{
    [UIView animateWithDuration:0.15 animations:^{
        self.view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
        self.contentView.bottom = kRBMainScreenHeight;
    }];
}

- (void)dismiss
{
    [UIView animateWithDuration:0.15 animations:^{
        self.view.backgroundColor = UIColor.clearColor;
        self.contentView.top = kRBMainScreenHeight;
    } completion:^(BOOL finished) {
        [self dismissViewControllerAnimated:NO completion:nil];
    }];
}

#pragma mark - Network

#pragma mark - Event

#pragma mark - Setter

#pragma mark - Getter

@end
